package com.wjw.rabbitmq.springbootorderrabbitmqconsumer.service.topic;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Service;

/**
 * 使用注解的方式绑定：交换机、队列、模糊路由Key
 */
@RabbitListener(bindings = @QueueBinding(
        value = @Queue(value = "sms.topic.queue",durable = "true",autoDelete = "false"),
        exchange = @Exchange(value = "topic_order_exchange",type = ExchangeTypes.TOPIC),
        key = "#.sms.#"
))
@Service
//使用@Service或者使用@Component
public class SMSConsumerTopic {

    @RabbitHandler
    public void receiveMessage(String message){
        System.out.println("sms.topic队列---接收到的订单消息是："+message);
    }
}
